<template>
   <div>
    <!-- <el-dialog v-bind="$attrs" v-on="$listeners" @open="onOpen" @close="onClose" title="Dialog Titile"> -->
    <el-dialog title="审核" :visible.sync="dialogFormVisible" @close="dialogFormH" >

      <el-form ref="processRef" :model="form" :rules="rules" size="mini" label-width="50px">
        <el-form-item label-width="0" prop="process">
          <el-radio-group v-model="form.process" size="mini">
            <el-radio v-for="(item, index) in processOptions" :key="index" :label="item.value"
              :disabled="item.disabled">{{item.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label-width="0" prop="reviewComments">
          <el-input v-model="form.reviewComments" type="textarea" placeholder="请输入审核意见"
            :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button  @click="dialogFormH">取消</el-button>
        <el-button type="primary" @click="handelConfirm(approvalInfo)">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { auditOpinions, choiceCheck } from '../../../api/hmmm/questions'
import { choice } from "@/api/hmmm/questions.js";

export default {
  inheritAttrs: false,
  components: {},
  props: {
      approvalInfo: {
        type: Object,
        default: () => ({})
      }
    },
  data() {
    return {
      dialogFormVisible : false,
      form: {
        process: 1,
        reviewComments: undefined,
      },
      rules: {
        process: [{
          required: true,
          message: '单选框组不能为空',
          trigger: 'change'
        }],
        reviewComments: [],
      },
      processOptions: [{
        "label": "通过",
        "value": 1
      }, {
        "label": "拒绝",
        "value": 2
      }],
    }
  },
  computed: {},
  watch: {},
  created() {
  },
  mounted() {},
  methods: {
    onOpen() {},
    // 弹层显示
    dialogFormV () {
      this.dialogFormVisible = true
    },
    // 弹层隐藏
    dialogFormH () {
      this.dialogFormVisible = false
      },
   async handelConfirm(approvalInfo) {
      console.log(approvalInfo.id)
      console.log(this.form.process)
      console.log(this.form.reviewComments)
      // approvalInfo.chkRemarks =this.form.reviewComments
        // chkRemarks = this.reviewComments
        try {
            const res =await choiceCheck({
           id:approvalInfo.id,
           chkState:this.form.process,
           chkRemarks:this.form.reviewComments	
           
        })
        console.log(res)
        this.$parent.getChoice()
        } catch (error) {
          console.log(error)
        }
      
        // choice()
        // this.$emit('getChoice')
        this.dialogFormVisible = false
    },
  }
}

</script>
<style>
</style>
